<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>oscP5 : : OscArgument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>OscArgument</h1>
		<dl><dt class="key">description</dt><dd class="value">an osc argument contains one value of values from a received osc message.
 you can convert the value into the required format, e.g. from Object to int
 theOscMessage.get(0).intValue();</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>/**
 * oscP5oscArgument by andreas schlegel
 * example shows how to parse incoming osc messages "by hand".
 * it is recommended to take a look at oscP5plug for an alternative way to parse messages.
 * oscP5 website at http://www.sojamo.de/oscP5
 */

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;

void setup() {
  size(400,400);
  frameRate(25);
  /* start oscP5, listening for incoming messages at port 12000 */
  oscP5 = new OscP5(this,12000);
  myRemoteLocation = new NetAddress("127.0.0.1",12000);
  /* send an OSC message to this sketch */
  oscP5.send("/test",new Object[] {new Integer("1"), new Float(2.0),"test string."}, myRemoteLocation);
  
}

void draw() {
  background(0);  
}

void oscEvent(OscMessage theOscMessage) {
  /* check if theOscMessage has the address pattern we are looking for. */  
  if(theOscMessage.checkAddrPattern("/test")==true) {
    /* check if the typetag is the right one. */
    if(theOscMessage.checkTypetag("ifs")) {
      /* parse theOscMessage and extract the values from the osc message arguments. */
      int firstValue = theOscMessage.get(0).intValue();  // get the first osc argument
      float secondValue = theOscMessage.get(1).floatValue(); // get the second osc argument
      String thirdValue = theOscMessage.get(2).stringValue(); // get the third osc argument
      print("### received an osc message /test with typetag ifs.");
      println(" values: "+firstValue+", "+secondValue+", "+thirdValue);
      return;
    }
  }
  println("### received an osc message. with address pattern "+
          theOscMessage.addrPattern()+" typetag "+ theOscMessage.typetag());
}
</pre></dd>
				</dl>
			</div>
			
			
			<!-- noConstructor:START
			<dl><dt class="key">constructors</dt><dd class="value"><pre></pre></dd></dl>
			noConstructor:END -->
			
			<!--
			
			-->
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="oscargument_method_blobvalue.htm">blobValue ( )</a></dt><dd class="value">get the byte array (blob) of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_booleanvalue.htm">booleanValue ( )</a></dt><dd class="value">get the boolean value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_bytesvalue.htm">bytesValue ( )</a></dt><dd class="value">get the byte array of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_charvalue.htm">charValue ( )</a></dt><dd class="value">get the char value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_doublevalue.htm">doubleValue ( )</a></dt><dd class="value">get the double value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_floatvalue.htm">floatValue ( )</a></dt><dd class="value">get the float value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_intvalue.htm">intValue ( )</a></dt><dd class="value">get the int value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_longvalue.htm">longValue ( )</a></dt><dd class="value">get the long value of the osc argument.</dd></dl>
<dl><dt class="key"><a href="oscargument_method_stringvalue.htm">stringValue ( )</a></dt><dd class="value">get the String value of the osc argument.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul><li><a href="oscmessage_class_oscmessage.htm">OscMessage</a></li>
</ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


